﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace KWT.DRG_DIP.API.Migrations
{
    /// <inheritdoc />
    public partial class _202504150852 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "Disease_Type",
                table: "Sys_DIP_Para",
                type: "varchar(256)",
                maxLength: 256,
                nullable: false,
                defaultValue: "",
                comment: "病种类型",
                oldClrType: typeof(string),
                oldType: "varchar(256)",
                oldMaxLength: 256,
                oldDefaultValue: "",
                oldComment: "DRG名称")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "QC_Err_Item",
                columns: table => new
                {
                    QIID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "主键")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ListID = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "清单ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ErrCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "错误代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Property = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "字段名")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QC_Err_Item", x => x.QIID);
                },
                comment: "质控历史记录")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Sys_QC_Err",
                columns: table => new
                {
                    ErrID = table.Column<string>(type: "varchar(255)", nullable: false, comment: "")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ErrCode = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "错误编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Type = table.Column<int>(type: "int", nullable: false, comment: "1:强制 2：疑似"),
                    Msg = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, defaultValue: "", comment: "信息提示")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsCodeErr = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "是否编码错误"),
                    Score = table.Column<decimal>(type: "decimal(18,2)", nullable: false, comment: "分值")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Sys_QC_Err", x => x.ErrID);
                },
                comment: "质控错误信息")
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "QC_Err_Item");

            migrationBuilder.DropTable(
                name: "Sys_QC_Err");

            migrationBuilder.AlterColumn<string>(
                name: "Disease_Type",
                table: "Sys_DIP_Para",
                type: "varchar(256)",
                maxLength: 256,
                nullable: false,
                defaultValue: "",
                comment: "DRG名称",
                oldClrType: typeof(string),
                oldType: "varchar(256)",
                oldMaxLength: 256,
                oldDefaultValue: "",
                oldComment: "病种类型")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");
        }
    }
}
